package com.bonc.ioc.service.impl;

import com.bonc.ioc.base.service.BaseService;
import com.bonc.ioc.config.OtherProperties;
import com.bonc.ioc.dao.AnnounceMapper;
import com.bonc.ioc.service.AnnounceService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @version 1.0
 * @description:
 * @author: wangqinglin
 * @date: 2021/4/9 11:34
 * @change : 2021/4/9 11:34 by q8541q@163.com  for init
 */

@Service
public class AnnounceServiceImpl extends BaseService implements AnnounceService {

    @Resource
    private AnnounceMapper announceMapper;

    @Resource
    private OtherProperties otherProperties;

    @Override
    public List<Map> getAnnounceList() {
        List<Map> list = announceMapper.getAnnounceList(otherProperties.getLoginId());
        for (Map map : list) {
            Object content = map.get("content");
            String s = String.valueOf(content).replaceAll("</?[^>]+>", "");
            String s1 = s.replaceAll("<a>\\\\s*|\\t|\\r|\\n</a>", "");
            map.put("content", s1);
        }
        return list;
    }
}
